package com.SpringMVC.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author:liuwei
 * @creatdate:2022-02-28-13:59
 */
@Controller
@RequestMapping("/hello")
public class RequestMappingController {
	@RequestMapping(
			value = {"/testRequestMapping", "/test"},
			method = {RequestMethod.GET, RequestMethod.POST},
			params = {"username"}
	)
	public String success() {
		return "success";
	}

	@RequestMapping(value = "/testParamsAndHeaders",
			params = {"username", "password!=123456"}
	)
	public String testParamsAndHeaders() {
		return "success";
	}

	@RequestMapping("/a?a/testAnt")
	public String testAnt() {
		return "success";
	}

	@RequestMapping("/a*a/testAnt1")
	public String testAnt1() {
		return "success";
	}

	@RequestMapping("/**/testAnt2")
	public String testAnt2() {
		return "success";
	}

	@RequestMapping("/testRest/{id}/{name}")
	public String testRest(@PathVariable("id") String id,@PathVariable("name") String name) {
		System.out.println("id=" +id+"name="+name);
		return "success";
	}

}
